package systems;

import components.Position;
import components.Velocity;

import com.artemis.Entity;
import com.artemis.EntityProcessingSystem;
import com.artemis.ComponentMapper;

public class MovementSystem extends EntityProcessingSystem {
		private ComponentMapper<Position> pos;
		private ComponentMapper<Velocity> vel;
		
		public MovementSystem()
		{
			super(Position.class, Velocity.class);
		}
		
		public void initialize()
		{
			pos = new ComponentMapper<Position>(Position.class, world);
			vel = new ComponentMapper<Velocity>(Velocity.class, world);
		}
		
		public void process(Entity e)
		{
			pos.get(e).setX(pos.get(e).getX() + world.getDelta() * vel.get(e).getX());
			pos.get(e).setY(pos.get(e).getY() + world.getDelta() * vel.get(e).getY());
		}
}
